 import request from '@/utils/request';
// import store from '@/store/'


 export const login = data =>{
   return request({
     method:'POST',
     url:'/app/v1_0/authorizations',
     data
   })
 }

 export const sendSms = mobile => {
   return request({
     method:'GET',
     url:`/app/v1_0/sms/codes/${mobile}`,
   })
 }

//  获取登录用户信息
export const getCurrentUser = () => {
  return request({
    method:'GET',
    url:'/app/v1_0/user',
    // headers:{
    //   Authorization: `Bearer ${store.state.user.token}`
    // }
  })
}

export const getChannels = () =>{
  return request({
    method:'GET',
    url:'/app/v1_0/user/channels',
  })
}

export const addFollow = userId =>{
  return request({
    method:'POST',
    url:'/app/v1_0/user/followings',
    data:{
      target: userId
    }
  })
}

export const deleteFollow = userId =>{
  return request({
    method:'DELETE',
    url:`/app/v1_0/user/followings/${userId}`,
  })
}

export const getUserProfile = () =>{
  return request({
    method:'GET',
    url:'/app/v1_0/user/profile',
  })
}

export const updateUserProfile = data =>{
  return request({
    method:'GET',
    url:'/app/v1_0/user/profile',
    data
  })
}

export const updateUserPhoto = data =>{
  return request({
    method:'PATCH',
    url:'/app/v1_0/user/photo',
    data
  })
}